package com.qf.smsplatform.pojo;


import org.springframework.util.ObjectUtils;

public class TMenu implements CheckNull{

  private Long id;
  private String name;
  private Long parentId;
  private String url;
  private String icon;
  private String perms;
  private Long type;
  private Long sort;
  private int state;

  public int getState() {
    return state;
  }

  public void setState(int state) {
    this.state = state;
  }

  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }


  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }


  public Long getParentId() {
    return parentId;
  }

  public void setParentId(Long parentId) {
    this.parentId = parentId;
  }


  public String getUrl() {
    return url;
  }

  public void setUrl(String url) {
    this.url = url;
  }


  public String getIcon() {
    return icon;
  }

  public void setIcon(String icon) {
    this.icon = icon;
  }


  public String getPerms() {
    return perms;
  }

  public void setPerms(String perms) {
    this.perms = perms;
  }


  public Long getType() {
    return type;
  }

  public void setType(Long type) {
    this.type = type;
  }


  public Long getSort() {
    return sort;
  }

  public void setSort(Long sort) {
    this.sort = sort;
  }

  @Override
  public boolean isNull(CheckType type) {
    switch (type){
      case ADD:
        return ObjectUtils.isEmpty(id)||ObjectUtils.isEmpty(name)||ObjectUtils.isEmpty(parentId)
            ||ObjectUtils.isEmpty(url)||ObjectUtils.isEmpty(icon)||ObjectUtils.isEmpty(perms)||
              ObjectUtils.isEmpty(type)||ObjectUtils.isEmpty(sort)||ObjectUtils.isEmpty(state);
      case UPDATE:
        return ObjectUtils.isEmpty(name)||ObjectUtils.isEmpty(parentId)
                ||ObjectUtils.isEmpty(url)||ObjectUtils.isEmpty(icon)||ObjectUtils.isEmpty(perms)||
                ObjectUtils.isEmpty(type)||ObjectUtils.isEmpty(sort)||ObjectUtils.isEmpty(state);

      case DELETE:
    }
    return false;
  }

  @Override
  public String toString() {
    return "TMenu{" +
            "id=" + id +
            ", name='" + name + '\'' +
            ", parentId=" + parentId +
            ", url='" + url + '\'' +
            ", icon='" + icon + '\'' +
            ", perms='" + perms + '\'' +
            ", type=" + type +
            ", sort=" + sort +
            ", state=" + state +
            '}';
  }
}
